package cn.iocoder.yudao.module.cmt.dal.mysql.base;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.cmt.controller.admin.base.vo.BaseMerchantStaffPageReqVO;
import cn.iocoder.yudao.module.cmt.dal.dataobject.base.BaseMerchantStaffDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 商户员工 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BaseMerchantStaffMapper extends BaseMapperX<BaseMerchantStaffDO> {

    default PageResult<BaseMerchantStaffDO> selectPage(BaseMerchantStaffPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseMerchantStaffDO>()
                .eqIfPresent(BaseMerchantStaffDO::getCommunityId, reqVO.getCommunityId())
                .eqIfPresent(BaseMerchantStaffDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(BaseMerchantStaffDO::getUserId, reqVO.getUserId())
                .likeIfPresent(BaseMerchantStaffDO::getStaffName, reqVO.getStaffName())
                .likeIfPresent(BaseMerchantStaffDO::getStaffPhone, reqVO.getStaffPhone())
                .eqIfPresent(BaseMerchantStaffDO::getRole, reqVO.getRole())
                .eqIfPresent(BaseMerchantStaffDO::getStaffStatus, reqVO.getStaffStatus())
                .eqIfPresent(BaseMerchantStaffDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(BaseMerchantStaffDO::getJoinTime, reqVO.getJoinTime())
                .betweenIfPresent(BaseMerchantStaffDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BaseMerchantStaffDO::getId));
    }

}
